import {TreeNode} from "./Tree.mts";

/**
 * @param {TreeNode} root
 * @return {number[]}
 */
var inorderTraversal = function (root: TreeNode) {
    let res: number[] = [];

    function digui(root: TreeNode) {
        if (root == null) return;
        res.push(root.val);

        root.left && digui(root.left);
        root.right && digui(root.right);
    };
    digui(root);
    return res;
};

const tree = new TreeNode(1, null, new TreeNode(2, new TreeNode((3)), null));
console.log(inorderTraversal(tree));
